package com.example.zhangwei.ui.tabactivityfragment.fragment;


import com.example.zhangwei.R;
import com.example.zhangwei.ui.activityfragment.MyFragmentActivity;
import com.example.zhangwei.ui.demo.ActivityLiving;
import com.example.zhangwei.ui.tabactivityfragment.activity.OneActivityFranment;
import com.example.zhangwei.ui.viewpagerfragment.ViewPagerFragment;
import com.example.zhangwei.util.MyLogger;

import android.support.v4.app.Fragment;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;


@SuppressLint("ValidFragment")
public class TwoFragment extends Fragment{
	
	private MyLogger log = MyLogger.getLogger("TwoFragment");
	
	private OneActivityFranment mMainview;

	private View contentView;
	
	public TwoFragment ()
	{
		
	}
	
	public TwoFragment(OneActivityFranment mainview)
	{
		mMainview = mainview;
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		log.e("----------onCreate-----------");
	}
	
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		log.e("----------onCreateView-----------");

		contentView = inflater.inflate(R.layout.activity_living2, container, false);
		Button btn = (Button)contentView.findViewById(R.id.activity_living_button2);
		btn.setText("跳转到OneFragment");
		btn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (mMainview != null )
					mMainview.setBody(new ThreeFragment(), 1111, true);
			}
		});
		// TODO Auto-generated method stub
		return contentView;
	}
	
	@Override
	public void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		log.e("----------onStart-----------");
	}
	
	@Override
	public void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		log.e("----------onResume-----------");
	}
	
	@Override
	public void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		log.e("----------onPause-----------");
	}
	
	@Override
	public void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		log.e("----------onStop-----------");
	}
	
	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		log.e("----------onDestroy-----------");
	}
	
	@Override
	public void onSaveInstanceState(Bundle outState) {
		// TODO Auto-generated method stub
		super.onSaveInstanceState(outState);
		log.e("----------onSaveInstanceState-----------");
	}

}
